package com.bw.gmall.realtime.dws.function;

import com.bw.gmall.realtime.dws.util.IkUtil123;
import org.apache.flink.table.annotation.DataTypeHint;
import org.apache.flink.table.annotation.FunctionHint;
import org.apache.flink.table.functions.TableFunction;
import org.apache.flink.types.Row;

import java.util.Set;

/**
 * @BelongsProject: gmall_lx
 * @BelongsPackage: com.bw.gmall.realtime.dws.util
 * @Author: cuizexuan
 * @CreateTime: 2025-06-22  20:13
 * @Description: TODO
 * @Version: 1.0
 */
@FunctionHint(output = @DataTypeHint("ROW<word STRING>"))
public class SplitFunction extends TableFunction<Row> {
    public void eval(String str) {
        Set<String> words = IkUtil123.split(str);
        for (String word : words) {
            collect(Row.of(word));
        }
    }
}
